/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.grass.plugin.dialect;

import com.grass.plugin.paging.page.Page;

/**
 * @author wujx
 * QQ 396246973
 * Date 2013-02-10
 */
public class PostgreDialect extends Dialect {

    public String getLimitString(String sql, Page page) {
        if (page.isPagination() == false) {
            return sql;
        }
        return new StringBuffer(sql.length() + 20).append(sql).append(" limit ").append(page.getPageSize()).append(" offset ").append(page.getPageStartRow()).toString();
    }
    
    @Override
	public String Escape(String sql,String lmark, String rmark) {	   
		return sql.replaceAll(lmark == null? "\\[" : lmark, "\\\"").replaceAll(rmark == null? "\\]" : rmark, "\\\"");
	}
}
